import { App, defineComponent } from "vue";
const exportIconFn = (app: App) => {
  const modules = import.meta.glob('./*.svg',
    { eager: true }
  );
  const list = Object.keys(modules)
  const nameList = list.map(item => {
    const modulePath = (modules[item] as any)
    const name = item.match(/\/([^/]+)$/)?.[1].split('.')[0]
    return { name: name, component: modulePath };
  })
  nameList.forEach((element) => {
    app.component('Icon-' + (element.name), defineComponent({
      render: element.component.render
    }))
  });

}
export default exportIconFn